package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PestDiseaseMapper2;
import com.ruoyi.system.domain.PestDisease2;
import com.ruoyi.system.service.IPestDiseaseService2;

import javax.annotation.Resource;

/**
 * 病虫害Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-30
 */
@Service
public class PestDiseaseService2Impl implements IPestDiseaseService2
{
    @Autowired
    private PestDiseaseMapper2 pestDiseaseMapper;

    /**
     * 查询病虫害
     * 
     * @param id 病虫害主键
     * @return 病虫害
     */
    @Override
    public PestDisease2 selectPestDiseaseById(Long id)
    {
        return pestDiseaseMapper.selectPestDiseaseById(id);
    }

    /**
     * 查询病虫害列表
     * 
     * @param pestDisease 病虫害
     * @return 病虫害
     */
    @Override
    public List<PestDisease2> selectPestDiseaseList(PestDisease2 pestDisease)
    {
        return pestDiseaseMapper.selectPestDiseaseList(pestDisease);
    }

    /**
     * 新增病虫害
     * 
     * @param pestDisease 病虫害
     * @return 结果
     */
    @Override
    public int insertPestDisease(PestDisease2 pestDisease)
    {
        pestDisease.setCreateTime(DateUtils.getNowDate());
        return pestDiseaseMapper.insertPestDisease(pestDisease);
    }

    /**
     * 修改病虫害
     * 
     * @param pestDisease 病虫害
     * @return 结果
     */
    @Override
    public int updatePestDisease(PestDisease2 pestDisease)
    {
        pestDisease.setUpdateTime(DateUtils.getNowDate());
        return pestDiseaseMapper.updatePestDisease(pestDisease);
    }

    /**
     * 批量删除病虫害
     * 
     * @param ids 需要删除的病虫害主键
     * @return 结果
     */
    @Override
    public int deletePestDiseaseByIds(Long[] ids)
    {
        return pestDiseaseMapper.deletePestDiseaseByIds(ids);
    }

    /**
     * 删除病虫害信息
     * 
     * @param id 病虫害主键
     * @return 结果
     */
    @Override
    public int deletePestDiseaseById(Long id)
    {
        return pestDiseaseMapper.deletePestDiseaseById(id);
    }
}
